﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.system.attend
{
    public partial class data_del : ModulePage 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                this.txtEndDate.Value = DateTime.Now.ToString();
            }
            if (this.Page.IsPostBack)
            {
                this.pnlMain.Visible = false;
                if (this.ckbDuty.Checked)
                {
                    new AttendDutyDao().DeleteByDateTime(base.Conn, Convert.ToDateTime((this.txtBeginDate.Value != string.Empty) ? this.txtBeginDate.Value : "2006-1-1"), Convert.ToDateTime((this.txtEndDate.Value != string.Empty) ? this.txtEndDate.Value : "2016-1-1"));
                }
                if (this.ckbOut.Checked)
                {
                    new AttendOutDao().DeleteByDateTime(base.Conn, Convert.ToDateTime((this.txtBeginDate.Value != string.Empty) ? this.txtBeginDate.Value : "2006-1-1"), Convert.ToDateTime((this.txtEndDate.Value != string.Empty) ? this.txtEndDate.Value : "2016-1-1"));
                }
                if (this.ckbOut.Checked)
                {
                    new AttendLeaveDao().DeleteByDateTime(base.Conn, Convert.ToDateTime((this.txtBeginDate.Value != string.Empty) ? this.txtBeginDate.Value : "2006-1-1"), Convert.ToDateTime((this.txtEndDate.Value != string.Empty) ? this.txtEndDate.Value : "2016-1-1"));
                }
                if (this.ckbOut.Checked)
                {
                    new AttendEvectionDao().DeleteByDateTime(base.Conn, Convert.ToDateTime((this.txtBeginDate.Value != string.Empty) ? this.txtBeginDate.Value : "2006-1-1"), Convert.ToDateTime((this.txtEndDate.Value != string.Empty) ? this.txtEndDate.Value : "2016-1-1"));
                }
                this.litMessage.Text = base.ShowPrompt("记录已删除！", "data_del.aspx");
            }
        } 

    }
}
